// 提示框
export default {
    namespaced: true,
    // 数据
    state: {
        // 是否提示框
        isShowToast: false,
        // 显示内容
        toastMsg: "手机号",
        // 显示状态
        toastType: "类型" //默认状态 success danger warning
    },
    mutations: {
        // 修改isShowToast的方法
        changeIsShowToast(state, payload) {
            // payload 变成一个对象接收 inShow:true msg:内容 type:状态
            state.isShowToast = payload.inshow
            if (payload.inshow) {
                state.toastMsg = payload.msg
                state.toastType = payload.type
            }
        }
    },
    actions: {
        asynChangeIsShowToast(state, payload) {
            console.log("changeIsShowToast");
            state.commit("changeIsShowToast", payload)
            let time = setTimeout(() => {
                state.commit("changeIsShowToast", {
                    inShow: false,
                })
                clearTimeout(time)
            }, 1500)
        }
    }
}